<!DOCTYPE html>
<html lang="en">

<head>
  <meta charset="UTF-8">
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <title>Document</title>
</head>

<body>
  <script>
    // var phone = {
    //   name: "华为",
    //   price: 19999,
    //   color: "绿色",
    //   play: function () { }
    // }
    //4 工厂函数 创建对象
    function fushikang(name, price, color) {
      var phone = {
        name: name,
        price: price,
        color: color,
        play: function () { }
      }
      return phone
    }
    var huawei = fushikang("华为p40", "10000", "蓝色");
    var phone12 = fushikang("绿色的iphone12", "9999", "绿色");
    console.log(huawei)
    console.log(phone12)


  </script>
</body>

</html>